package com.frxuexi.shop2307.view

import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.ImageView
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.frxuexi.lib_base.mvvm.BaseActivity
import com.frxuexi.lib_base.utils.GlideUtils
import com.frxuexi.shop2307.R
import com.frxuexi.shop2307.databinding.ActivityPinDetailBinding
import com.youth.banner.loader.ImageLoader
import dagger.hilt.android.AndroidEntryPoint

@Route(path = "/app/PinDetailActivity")
@AndroidEntryPoint
class PinDetailActivity : BaseActivity<ActivityPinDetailBinding,PinViewModel>() {
    @JvmField
    @Autowired
    var id=-1

    override fun initData() {
        vm.pinDetailData.observe(this){
            binding.bean=it.storeCombination
        }

    }

    override fun initView() {
        val imgs= listOf<String>("http://10.161.9.80:8080/crmebimage/public/maintain/2021/12/25/7a6475bba07c47bb98e5db0e0d21c8ebq5sw2kijlc.jpg",
            "http://10.161.9.80:8080/crmebimage/public/maintain/2021/12/25/37382cca048b4011bdbacd3cbbe0814daw1o5x0tco.jpg",
            "http://10.161.9.80:8080/crmebimage/public/maintain/2021/12/25/fef1aee22a04466d93693f5791d44bfd2rsm469mcr.jpg",
            "http://10.161.9.80:8080/crmebimage/public/maintain/2021/12/25/f65ef5469f3a479497a710fb288d115cvl5imkvpo8.jpg",
            "http://10.161.9.80:8080/crmebimage/public/maintain/2021/12/25/3ed152917e3f4f7faa9414050b6cab49vuadulntb8.jpg",
        )
        binding.detailVp.apply {
            setImages(imgs)
            setImageLoader(object: ImageLoader(){
                override fun displayImage(context: Context?, path: Any?, imageView: ImageView?) {
                    GlideUtils.getImage(imageView!!,path.toString())
                }
            })
            start()
        }
        ARouter.getInstance().inject(this)
        vm.getPinDetail(id)
    }

}